package order.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import common.model.result.Result;
import common.model.goods.Sku;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import order.service.impl.GoodsServiceFeignClientFallback;

@Service
@FeignClient(name = "goods-server", fallback = GoodsServiceFeignClientFallback.class)
public interface GoodsServiceFeignClient {
    //根据skuId查询sku
    @GetMapping("/goods/sku/{id}")
    Result getSkuById(@PathVariable("id") Long id);
    //根据spuId查询spu
    @GetMapping("/goods/spu/{id}")
    Result getSpuById(@PathVariable("id") Long id);
    //更新sku库存
    @PutMapping("/goods/updateSkuStock")
    Result updateSku(@RequestBody Sku sku);
}
